package com.ysxsoft.wdg.ui.activity.my;

import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;
import com.ysxsoft.wdg.R;
import com.ysxsoft.wdg.base.BaseActivity;
import com.ysxsoft.wdg.bean.BaseBean;
import com.ysxsoft.wdg.net.CallbackCode;
import com.ysxsoft.wdg.util.ToastUtils;
import com.ysxsoft.wdg.util.WebViewUtils;
import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public class FwtkActivity extends BaseActivity {


    @BindView(R.id.topView)
    View topView;
    @BindView(R.id.title_content)
    TextView titleContent;
    @BindView(R.id.webView)
    WebView webView;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_fwtk;
    }

    @Override
    protected void initData() {
        initStatusBar(topView,false);
        titleContent.setText("服务条款");

        WebViewUtils.init(webView);

        mApiHelper.getFwlk(new Observer<BaseBean<String>>() {
            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(BaseBean<String> baseBean) {
                if (baseBean.getCode().equals(CallbackCode.SUCCESS)){
                    WebViewUtils.setH5Data(webView,baseBean.getData());
                }else {
                    ToastUtils.showToast(baseBean.getMs());
                }
            }

            @Override
            public void onError(Throwable e) {
                ToastUtils.showToast("请稍后再试");
            }

            @Override
            public void onComplete() {

            }
        });
    }

    @Override
    protected void setListener() {

    }


    @OnClick(R.id.title_finish)
    public void onViewClicked() {
        finish();
    }
}
